<div ng-controller="Supplier_DepotRecordsC">
    <div class="bg-light lter b-b wrapper-md">
        <h1 class="m-n font-thin h3">供应商流水</h1>
    </div>
    <div class="wrapper-md" style="text-align: right;">
        <div class="panel panel-default">
            <div class="panel-heading">
                <button type="button" class="btn btn-default" ng-click="goorderList()">返回</button>
            </div>
            <div class="table-responsive text-center" >
                <table id="example1" class="table table-striped b-t b-light">
                    <thead>
                    <tr>
                        <th style="text-align: center;">创建时间</th>
                        <th style="text-align: center;">商品名称</th>
                        <th style="text-align: center;">类型</th>
                        <th style="text-align: center;">本次实重</th>
                        <th style="text-align: center;">原有库存/总重（t）</th>
                        <th style="text-align: center;">现有库存/总重（t）</th>
                        <th style="text-align: center;">单价/数量</th>

                    </tr>
                    </thead>
                    <tbody>
                    <tr ng-repeat="item in pageData.Data">
                        <td style="width: 20%">{{item.CreateTime}}</td>
                        <td style="width: 20%">{{item.Commodity.Brand}}/{{item.Commodity.Name}}/{{item.Commodity.Standard}}/{{item.Commodity.Format}}</td>
                        <td ng-if="item.Type == 1" style="width: 10%">入库</td>
                        <td ng-if="item.Type == 0" style="width: 10%">出库</td>
                        <td ng-if="item.Type == 2" style="width: 10%">冻结</td>
                        <td ng-if="item.Type == 3" style="width: 10%">解冻</td>
                        <td style="width: 8%">{{item.TotalWeight | number:3}}</td>
                        <td style="width: 15%">{{item.BeforeTotalCount | number:2}}/{{item.BeforeTotalWeight | number:3}}</td>
                        <td style="width: 15%">{{item.AfterTotalCount | number:2}}/{{item.AfterTotalWeight | number:3}}</td>
                        <td style="width: 12%">{{item.Price | number:2}}/{{item.Count | number:2}}</td>
                    </tr>
                    </tbody>
                </table>
                <div class="panel-heading" ng-include="'/htm/tpl/Supplier/Paging.html'">

                </div>
            </div>
        </div>
    </div>
</div>
<script>
    angular.module('app')//非标优惠
            .controller("Supplier_DepotRecordsC", function ($scope, $state, $http, $stateParams) {
                $scope.id = $stateParams.id;
                $scope.pageData = {};
                $scope.pageData.Page = 1;
                if($stateParams.num == 0){
                    $scope.myurl2 = 'app.TraderManage_List';
                } else if ($stateParams.num == 1) {
                    $scope.myurl2 = 'app.Warehouse_List';
                } else {
                    $scope.myurl2 = 'app.Provider_List';
                }
                $scope.pageData.Rows = $scope.defPageRows;
                //
                $scope.getData = function (p, r) {
                    if (p) {
                        p = p < 1 ? 1 : p;
                    } else p = 1;
                    if (r) {
                    } else r = $scope.defPageRows;
                    $http({
                        url: "../api/Provider/GetDepotRecords?providerId=" + $scope.id + "&page=" + p + "&rows=" + r,
                        method: "GET"
                    })
                            .then(function (res) {
                                $scope.pageData = res.data;
                                console.log($scope.pageData);
                            })
                            .then(function (error) {
                                if (error) {
                                    alert("数据获取失败");
                                }
                            });
                };
                $scope.getData(1, $scope.pageData.Rows);
                //返回仓库列表
                $scope.goorderList = function () {
                    $state.go($scope.myurl2)
                };
            })

</script>
